home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12079 < prev    next >
Encoding:
Text File  |  1996-08-05  |  910 b   |  36 lines

  1. Path: EU.net!sun4nl!xs4all!usenet
  2. From: stijnw@xs4all.nl (Stijn Wolters)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: string search?
  5. Date: Thu, 28 Mar 1996 17:54:19 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4jek23$ba9@news.xs4all.nl>
  8. References: <4jbmtk$78k@dfw-ixnews3.ix.netcom.com>
  9. NNTP-Posting-Host: asd09-23.dial.xs4all.nl
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. rmor1@ix.netcom.com(Ricardo Mor ) wrote:
  13.  
  14. >    How can I search for a string of characters within another string?
  15. >for example..
  16.  
  17. >    string = "NEXT_TIME";
  18. >    
  19. >    string2 = "NEXT";
  20.  
  21. >    how can I find  string2 in string?
  22.  
  23. In "string.h" is a function "strstr", which is (I think) the function
  24. you are looking for:
  25.  
  26. char *strstr(char *s1, char *s2);
  27.  
  28. strstr returns a pointer to the position where s2 occurs for the first
  29. time in s1, it returns NULL if s2 is not found in s1.
  30.  
  31. Greetings,
  32. Stijn Wolters (stijnw@xs4all.nl)
  33.  
  34.  
  35.  
  36.